﻿@page "/UPdataFullPage"
@inject UpdataServer updataServer
@using System.ComponentModel
@using AntDesign.TableModels
@inject ModalService _modalService
@inject MessageService _message
<h3>满卷缓存架更新</h3>
<div>
    <Row>
        <Col Span="24">
        <label>输入满卷缓存架编号</label>
        </Col>
    </Row>
    <Row>
        <Col Span="8" Push="8">
        <Input style="width:100%" @bind-Value="@Remark"></Input>
        </Col>
    </Row>
    @if (FullCache != null)
    {
        <Descriptions Title="缓存架信息">
            <DescriptionsItem Title="编号">@FullCache.Remark</DescriptionsItem>
        </Descriptions>
        <Descriptions Title="烘烤状态">
        </Descriptions>
        <Select style="width:100%" DataSource="@GlobalValues.BakingStates"
            @bind-Value="FullCache.BakingState"
            ValueName="@nameof(Val_Des.Val)"
            LabelName="@nameof(Val_Des.Description)">
        </Select>
        <Descriptions Title="是否有料">
        </Descriptions>
        <Switch @bind-Value="@FullCache.IsHave"></Switch>
        <br>
        <br>
        @if (FullCache.IsEnable == true && FullCache.IsCreat == false)
        {
            <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Creat1">更新状态</Button>

        }
    }
    <br>
    <br>
    <Row>
        <Col Span="24">
        <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Cheek">查询</Button>
        </Col>
    </Row>
</div>

@code {
    FullCache_Entity FullCache = null;
    string Remark { get; set; }

    protected override async Task OnInitializedAsync()
    {


        base.OnInitialized();
    }

    private async Task Cheek()
    {
        if (!string.IsNullOrEmpty(Remark))
        {
            FullCache = await updataServer.GetCache(Remark);
            StateHasChanged();
        }

    }

    private async Task Creat1()
    {
        _modalService.Confirm(new ConfirmOptions()
            {
                Title = "提示",
                Icon =@<Icon Type="exclamation-circle" Theme="Outline"></Icon>,
            OkText = "确认",
            OnOk = async (e) =>
            {
                var a = await updataServer.UpdataFull(FullCache);
                _message.Info(a);
            },
            CancelText = "取消",
            Content = "是否提交？",
        });
    }
    private async Task Creat2()
    {
        _modalService.Confirm(new ConfirmOptions()
            {
                Title = "提示",
                Icon =@<Icon Type="exclamation-circle" Theme="Outline"></Icon>,
    OkText = "确认",
    OnOk = async (e) =>
    {
        var a = await updataServer.UpdataHave(Remark);
        _message.Info(a);
    },
    CancelText = "取消",
    Content = "是否提交？",
});
    }
}

